package com.oh.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

/**
 * 
 * 卡片展示界面
 * 
 * 1.显示卡片
 * 2.修改卡片数据
 * 
 * @author Alex.Lu
 *
 */
public class CardActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
	
	private ImageButton mBackBT;
	private TableLayout mCards;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_card);
        
        mCards = (TableLayout)findViewById(R.id.cards_table);
        
        for(int i=0;i<20;i++){
        	TableRow row = new TableRow(this);
        	row.setBackgroundColor(0xff8d8aa0);
        	row.setPadding(2, 1, 1, 2);
        	TextView t1 = new TextView(this);
        	t1.setText("标签一"+i);
        	t1.setTextColor(0xff000000);
        	t1.setTextSize(20);
        	t1.setPadding(10, 10, 10, 10);
        	t1.setBackgroundColor(0xffffffff);
        	row.addView(t1);
        	
        	TextView t2 = new TextView(this);
        	t2.setText("标签二"+i);
        	t2.setTextColor(0xff000000);
        	t2.setTextSize(20);
        	t2.setPadding(10, 10, 10, 10);
        	t2.setBackgroundColor(0xffffffff);
        	row.addView(t2);
        	
        	TextView t3 = new TextView(this);
        	t3.setText("标签三"+i);
        	t3.setTextColor(0xff000000);
        	t3.setTextSize(20);
        	t3.setPadding(10, 10, 10, 10);
        	t3.setBackgroundColor(0xffffffff);
        	row.addView(t3);
        	
        	mCards.addView(row);
        }
        mBackBT = (ImageButton)findViewById(R.id.back_btn);
        mBackBT.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		int v_id = v.getId();
		switch (v_id) {
		case R.id.back_btn:
			finish();
			break;

		default:
			break;
		}
	}
}